UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XHt4Z4Zw5+NViTUkdsefmXnopZ5+tQJs85larEXOcLM=' 
WHERE 
  key_id = 'aa4cc91fc634719ddd4a24c835701e911a24504cb8352ebc6ea3465ce1278109' 
  AND (
    token = 'XHt4Z4Zw5+NViTUkdsefmXnopZ5+tQJs85larEXOcLM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040