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