UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GePjK87rimDHpkryks9c18VyeCUTK4+fPqIcm2rRtBc=' 
WHERE 
  key_id = '6ef3abd29031f67e8a2b54cadb67377d952e6f4f24811fe0cf429badef7b8f9a' 
  AND (
    token = 'GePjK87rimDHpkryks9c18VyeCUTK4+fPqIcm2rRtBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031