UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A/XbtpWFUVJ7NQ0rKAKa0x3qV6YTWcz+lHYY94/tkW4='
WHERE
key_id = '3f243f9956fba142adbd26496bb27fb083a8565673bb17a579ce8b5d9bfbb5e0'
AND (
token = 'A/XbtpWFUVJ7NQ0rKAKa0x3qV6YTWcz+lHYY94/tkW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)