UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0O4yi3EhfwWVCfTPzjxWlLqVmuJjtriVWIMJDpUVfXs='
WHERE
key_id = '5a7c50b0f2c4878cd12bf042c318f9546f85d71a04e161f99d136962aba738f0'
AND (
token = '0O4yi3EhfwWVCfTPzjxWlLqVmuJjtriVWIMJDpUVfXs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)