UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IQ2pus7dtBvdfEW0ANqPqxwB6uvlYLzKr61otoOjg90='
WHERE
key_id = 'ad7e883449eeccdc65ae32299f6c25643f00f0e641b687bc4f6af90dd41ae858'
AND (
token = 'IQ2pus7dtBvdfEW0ANqPqxwB6uvlYLzKr61otoOjg90='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)