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

Query time 0.00037