UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MK3b/Xzc5W77ge29YLHcjXoLWrZnf4+V73ZEOAFaZwY='
WHERE
key_id = 'c3b602f2fd26dfbd13a18ce1fb486c500a24eebe67adf6713d15418768eef965'
AND (
token = 'MK3b/Xzc5W77ge29YLHcjXoLWrZnf4+V73ZEOAFaZwY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)