UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IcQJnROYNdP7+yDplKMheWEWpYRVlmJphwpBp+yQ5hM='
WHERE
key_id = '7d712ea6ee6001bf7758484a447493c32e50d7bfcd5384638a31028d6fe336b8'
AND (
token = 'IcQJnROYNdP7+yDplKMheWEWpYRVlmJphwpBp+yQ5hM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)