UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Nyt027235BuO+ErCSbcJAeWaW5uzm7mv88CVMvs3O18='
WHERE
key_id = 'c47b8397f4641bf61d5b321bf3cadb3209972613df14dc900066a9b81b37bf2b'
AND (
token = 'Nyt027235BuO+ErCSbcJAeWaW5uzm7mv88CVMvs3O18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)