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

Query time 0.00046