UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AIuTKjmkNdRzSoHm5Gll+ntQramfWL4OOmT6TrRo1TM=' 
WHERE 
  key_id = '45c175f01348f36c75f501da9690baea3cfddf9769c01fffb2f53edc679cb24d' 
  AND (
    token = 'AIuTKjmkNdRzSoHm5Gll+ntQramfWL4OOmT6TrRo1TM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025