UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gi4usx1Pwk1wgaFonf11fm3z0eMe4+7wocGNfowuYYU='
WHERE
key_id = '1b346ab43729b71375385902849e6b0295ba003a89ece597bdb9be400cfad2f1'
AND (
token = 'gi4usx1Pwk1wgaFonf11fm3z0eMe4+7wocGNfowuYYU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)