UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JTImW6Da7mdPepvBsEDRqmyIiSrHGEhr20orBmt6+xw='
WHERE
key_id = '12d26741959358a40f1490b3f6a651da1e4fcd1808e71fa44c5b8d57bd44ad06'
AND (
token = 'JTImW6Da7mdPepvBsEDRqmyIiSrHGEhr20orBmt6+xw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)