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