UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dP8iF/Jtl9+NxpUmGrZwqONYf+GZ/5Cm3CESVlNMzP8='
WHERE
key_id = 'c97eee1e033da94262416b52c0b376fd4ded387c5ec941e1b92bea2b4d81c663'
AND (
token = 'dP8iF/Jtl9+NxpUmGrZwqONYf+GZ/5Cm3CESVlNMzP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)