UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YWMGRyVR5XzMVikJk1/QI3WHO3b5LxaX01e3P1as434=' 
WHERE 
  key_id = '5307ed72a5067d7573977c6fed1ec9c74cc541bf703b0cdae9e0fbb9f0157e7a' 
  AND (
    token = 'YWMGRyVR5XzMVikJk1/QI3WHO3b5LxaX01e3P1as434=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044