UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aN/Upp7a8XGHq4ja7+dGdGqJVIten+47hkn9YSSoB5U=' 
WHERE 
  key_id = '34d75821781c15d2fdfbf8a33f46a522a1cd289e9b17661e43160cedd48ce578' 
  AND (
    token = 'aN/Upp7a8XGHq4ja7+dGdGqJVIten+47hkn9YSSoB5U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032