UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N8g2mkQhemAmIlvVDyz+y3SR/IlqGYzl600Gr1drSEo='
WHERE
key_id = '3a784e2a45ea54bc49978f0ff9921671bdf70b4667bf8617700dea4df7695321'
AND (
token = 'N8g2mkQhemAmIlvVDyz+y3SR/IlqGYzl600Gr1drSEo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)