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