UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's6N45QRw0DNIMA9CXvWALMziwls8znisdI5Wz79YpZA=' 
WHERE 
  key_id = '0ecac979ce2160a90ce7d6bb007fca53c27ee95414719e0d7ce5cd6fc8d520d9' 
  AND (
    token = 's6N45QRw0DNIMA9CXvWALMziwls8znisdI5Wz79YpZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037