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