UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ug6redHUZ2X5P57Xcj+6P8ELA0tctctxlJcy0sy19Pk='
WHERE
key_id = '4493afae8457efd326a1a61d1a0ebc78a6d5f40263f9b4beaf29d936675165dd'
AND (
token = 'Ug6redHUZ2X5P57Xcj+6P8ELA0tctctxlJcy0sy19Pk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)