UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OGKY2l/VSHHJoxyN0UaWftyN0+hRdHhNYimKzHwtQC8='
WHERE
key_id = '3e34ae3ccaf1163b3d15b96c1c66e164413273fef392f63427e2fbb4275a42b5'
AND (
token = 'OGKY2l/VSHHJoxyN0UaWftyN0+hRdHhNYimKzHwtQC8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)