UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TPuKAOdcbLB9YInXZ/prgUeBthNSjhQ3DOOTEP2u648='
WHERE
key_id = 'f385283af0c94eb3b2fa5dcbdef927dc2cca4cb97aa053c97165bdff617af1ed'
AND (
token = 'TPuKAOdcbLB9YInXZ/prgUeBthNSjhQ3DOOTEP2u648='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)