UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9hF0Uv5ewKYbpKfCYEC1TXuKzaMb8f9+MsL6zAsUEWY='
WHERE
key_id = '117bd5a1defc803df95822ff42e42d9fcb4b65b0a1b4d367c0940f4baaa79748'
AND (
token = '9hF0Uv5ewKYbpKfCYEC1TXuKzaMb8f9+MsL6zAsUEWY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)