UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X1Rg8H23g7a1gLG9zUvYGNiphMW5dcTYtPsNvgq7yDw=' 
WHERE 
  key_id = '831cdf53b960407c6263d36cda5ccf945af4c11cad38f84314481ffbf89e3488' 
  AND (
    token = 'X1Rg8H23g7a1gLG9zUvYGNiphMW5dcTYtPsNvgq7yDw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035