UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'koAU1JcSTinV0CnXTp1I4DPbtDfq/5pu5kP6EBjHmOQ=' 
WHERE 
  key_id = '9256ceb58100ee28c1fa451ce4ea66ed83accbce167534f4f7b2b9a687251484' 
  AND (
    token = 'koAU1JcSTinV0CnXTp1I4DPbtDfq/5pu5kP6EBjHmOQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026