UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SGzOO6Yjt0oIGEJMbmxEaQKFzbxhnFGo4xq+vSSFHzU=' 
WHERE 
  key_id = 'a0c5df046dfe1dff3872015f9be1e81294e520630717bfbcd22e5e5875907b26' 
  AND (
    token = 'SGzOO6Yjt0oIGEJMbmxEaQKFzbxhnFGo4xq+vSSFHzU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050