UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cYMPzUHQRhcU+/6pqa9+hPeNBRupi8Va+k4bNKDiU2o=' 
WHERE 
  key_id = 'f7e8c564a06b8438d33b32cbfe29d641a07c7457145615b0fb5bdffb1bceeab4' 
  AND (
    token = 'cYMPzUHQRhcU+/6pqa9+hPeNBRupi8Va+k4bNKDiU2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028