UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gxKzuhj5h54sMmSq3KhX2MPuvYP0xZnqfUeESWEqIOM=' 
WHERE 
  key_id = '72dbd0faaa2ac1830b0a68e46fd4f1b94bca274f901c559bf04dac9f67c9ee19' 
  AND (
    token = 'gxKzuhj5h54sMmSq3KhX2MPuvYP0xZnqfUeESWEqIOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029