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

Query time 0.00054