UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q2Ep2qWb4RlVrf0Y50wl9u2jzMESvfpTRDE4CTJQ0AE=' 
WHERE 
  key_id = '503d7a7dde76ed72021df21baa442a0f2a9e39a08ffefe7ac0ae3a1c85672f2e' 
  AND (
    token = 'q2Ep2qWb4RlVrf0Y50wl9u2jzMESvfpTRDE4CTJQ0AE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040