UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VDz02McMaK1oN/CAtKILrNks2KoCWaVZB6yMJb1Ji94=' 
WHERE 
  key_id = 'c473760dc0e6ab2574cb908f5977c382e3612163a9a42f237a3bc970ee114899' 
  AND (
    token = 'VDz02McMaK1oN/CAtKILrNks2KoCWaVZB6yMJb1Ji94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019