UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WVb6S8GLvmiMWgzhQc5FChlCakm/5+cY0SrvGMkUBEs='
WHERE
key_id = 'cd9fd851f2980c78b8d0d828b55b68b21c81157b8785531f9ff271cc4a482781'
AND (
token = 'WVb6S8GLvmiMWgzhQc5FChlCakm/5+cY0SrvGMkUBEs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)