UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4yIvqyyYxoOhlytTwfT7NO+avRkqK5quOKU+fdkIcX0=' 
WHERE 
  key_id = '46e45d72155209cc577253372684b379b70e04a3f1b3b85b69317e33bcd38002' 
  AND (
    token = '4yIvqyyYxoOhlytTwfT7NO+avRkqK5quOKU+fdkIcX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032