UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZmS1kRbijkvtg2+aP0ROeqXGW7cpzPhX99Px2oPhGV0='
WHERE
key_id = '64d5b4110d9fe77154dbb49fb3dcffa6b14d0ef7044115aa9617a55ce71a40d1'
AND (
token = 'ZmS1kRbijkvtg2+aP0ROeqXGW7cpzPhX99Px2oPhGV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)