UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3n1eUOVJ9eAnSgeQhKxDYOoykBfC9FEnfIAbKFkhH88='
WHERE
key_id = '705a402da0606dc650316de35b368e6a782beebc2560faf9108462fd39770628'
AND (
token = '3n1eUOVJ9eAnSgeQhKxDYOoykBfC9FEnfIAbKFkhH88='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)