UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ulzNubJ9fFtNcE+nIywFON9ON0aiVKcapzlHYDj4thU='
WHERE
key_id = 'b9eed2653ca43d34443a2298cfcc7f99758e5a7c9dc0b2526e16d2c819e5b305'
AND (
token = 'ulzNubJ9fFtNcE+nIywFON9ON0aiVKcapzlHYDj4thU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)