UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WrAYgYl1z5Lp/KYfZbE14NSS1YoeaunBjyPLnkP7Zbw=' 
WHERE 
  key_id = '8cb5e73182238f430478ce9a8b369a3af455032a9bfa2f5705f2dc3ad52de821' 
  AND (
    token = 'WrAYgYl1z5Lp/KYfZbE14NSS1YoeaunBjyPLnkP7Zbw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051