UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IShhNTGb4Kb0izMRL4nc23CsL7dHtNfqDY7j7zr8dp8=' 
WHERE 
  key_id = '59cc1bccc363950137709b0618c4041b802469eb546751afba425a1321c902a7' 
  AND (
    token = 'IShhNTGb4Kb0izMRL4nc23CsL7dHtNfqDY7j7zr8dp8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040