UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N++JgjS2r3OL1sfvJm+Zk0aChqKHA09XhQBnJhGh+fg='
WHERE
key_id = 'cb9ceb692e91c399547d2e3b8c8f36d3dd5830cba16201532711460f78ecf7b7'
AND (
token = 'N++JgjS2r3OL1sfvJm+Zk0aChqKHA09XhQBnJhGh+fg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)