UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AmNOU4M98vuomzHnCmdCxwkrtWbpp7XbFQhLYqApNQQ=' 
WHERE 
  key_id = '411da30a808ec143aac402fbd1d5b3a969049853ec9a950b5fccbd1263d3a7a2' 
  AND (
    token = 'AmNOU4M98vuomzHnCmdCxwkrtWbpp7XbFQhLYqApNQQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039