UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/CSIivgYnToW6Rg+acA8dLSa9zfd03sayDztsx5CSW4='
WHERE
key_id = 'c3805e6d7065d3256028b6ed95c3c27a07e35cf663884895a9880e6fa19cea63'
AND (
token = '/CSIivgYnToW6Rg+acA8dLSa9zfd03sayDztsx5CSW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)