UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ziIaICBnTTEquA6xsKeToHWwZ7zHxzh6sH9BOgT/RPk='
WHERE
key_id = 'a4a62c2ccefe4d583fc7e6d130f7714dba96e12454a6699d239e4d46dc307da4'
AND (
token = 'ziIaICBnTTEquA6xsKeToHWwZ7zHxzh6sH9BOgT/RPk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)