UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WVz8H1aeRBanUSqkjfrLZVKx7cQO26Y6aY23qVn6YNI=' 
WHERE 
  key_id = 'd48f026edf05012394598ada663d1a60bf03e30eb8aee4a81a98b278af4e7cad' 
  AND (
    token = 'WVz8H1aeRBanUSqkjfrLZVKx7cQO26Y6aY23qVn6YNI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030