UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QakKprtM38jAiUOyaVTchQG8m9ZihdW7crr6h91IkvE=' 
WHERE 
  key_id = '03435af557195a56e9fca4d921cd84290d4686911fcf5e356a5408c25b074057' 
  AND (
    token = 'QakKprtM38jAiUOyaVTchQG8m9ZihdW7crr6h91IkvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023