UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sq7k2o0TJm5ep7gnWXLYxhx3YjoO8wnDiazwSRAoq4I=' 
WHERE 
  key_id = 'd936b817190dd58e1c2d6f807148b7035384128b744aaf2f3852cd77227cbe42' 
  AND (
    token = 'sq7k2o0TJm5ep7gnWXLYxhx3YjoO8wnDiazwSRAoq4I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021