UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bnIu/uunOMkHjuu3Y/p6JLGsGbBg3tYsjoB/7tamfzM=' 
WHERE 
  key_id = '427f23c7229e067099c288d956db4bcc5d92889c58c3e62c93781364c8f78540' 
  AND (
    token = 'bnIu/uunOMkHjuu3Y/p6JLGsGbBg3tYsjoB/7tamfzM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024