UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'juHCKygj/akXuShglcocm14pVo4XRxOSLS3mJDjItuA=' 
WHERE 
  key_id = 'e76b02392b793399213dbd22041cec167ba69c22dd10e1d847096875a5d18414' 
  AND (
    token = 'juHCKygj/akXuShglcocm14pVo4XRxOSLS3mJDjItuA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050