UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RhOCq3qW+nZI8+zQXrm0Ue3kwRQIPVh8vvo5uGBE54w=' 
WHERE 
  key_id = 'ee22fca62c37b7853752392bac7314f896b3979e70dd3c1d14a06e3c945fa020' 
  AND (
    token = 'RhOCq3qW+nZI8+zQXrm0Ue3kwRQIPVh8vvo5uGBE54w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065