UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e/IAENmFzBA7QzNceUDuFaGggLqG1G2s4C7EGspcVYA=' 
WHERE 
  key_id = '5658c689ee78e69ba75fdbf3a87640ca66b307653695668b8534d4925ed79bb9' 
  AND (
    token = 'e/IAENmFzBA7QzNceUDuFaGggLqG1G2s4C7EGspcVYA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036