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