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