UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CSbp6HE9kjEinWhzzmM0RBYZoHeL1ufnl0BUtwyQODI='
WHERE
key_id = '0aaec1364c69b05cd925beacdb5fa15f749ad219c285a5168b28436a13794350'
AND (
token = 'CSbp6HE9kjEinWhzzmM0RBYZoHeL1ufnl0BUtwyQODI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)