UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3O0m7V9SUpnq6pE1xE1UxT19zJUIU+EeYUy8g+34ha0=' 
WHERE 
  key_id = 'fd38092d5bf2111051e3756d0d7352816320cac99617e144ccb3afdfb14553aa' 
  AND (
    token = '3O0m7V9SUpnq6pE1xE1UxT19zJUIU+EeYUy8g+34ha0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025