UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AwtF8C5BWoUyYf5MDiThW7CnZExWGzGk+Xivxct1P74=' 
WHERE 
  key_id = '2b111a5869b9ae8a58ab57dc05d4691aa491a507d3cc6597ad199b4696418539' 
  AND (
    token = 'AwtF8C5BWoUyYf5MDiThW7CnZExWGzGk+Xivxct1P74=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030