UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YvN71B45pF+U2edXJt4tig6dUhuAW3Ll550L0G5yYX4=' 
WHERE 
  key_id = '9c8323e3c1eed540a191ec62a21ee3a60651636804b9d3ae7d289a768f0ea020' 
  AND (
    token = 'YvN71B45pF+U2edXJt4tig6dUhuAW3Ll550L0G5yYX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028