UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YZLSdVWKp6EjQHhUDXllE+70ETzIX8swrMt8qAYsm10='
WHERE
key_id = 'a560e82d6d3a01a830f9e561fab89bf42d380d0ed909adca7788b7ad2ea82844'
AND (
token = 'YZLSdVWKp6EjQHhUDXllE+70ETzIX8swrMt8qAYsm10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)