UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ggcxmGWO+rfhD+AdPHD59AiI/rNWg5p0vfMXtnIkxQY=' 
WHERE 
  key_id = '07871f2087ca7d54caad6ea905adf0daec4b7346e17d190a11e230a43d61f492' 
  AND (
    token = 'ggcxmGWO+rfhD+AdPHD59AiI/rNWg5p0vfMXtnIkxQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040