UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pYX5OE8UBBQ/iwVlen78KtHb+tUc/nuudAyirP316q4='
WHERE
key_id = '64b9b98c59c4c6745373fa65c9f9442494949943a350a8ba05bd0b3baf3d3e4a'
AND (
token = 'pYX5OE8UBBQ/iwVlen78KtHb+tUc/nuudAyirP316q4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)