UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R0rkBsSG6oh1lITtDqEi1ja/dGVKciqxw7Fr4TH9+cA=' 
WHERE 
  key_id = 'e17a7d0424f306f6df7bb6358825c4d46210ff2e87d5c783831153cda4b00fd3' 
  AND (
    token = 'R0rkBsSG6oh1lITtDqEi1ja/dGVKciqxw7Fr4TH9+cA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025